package com.david.server.rpc;

import org.hibernate.Session;

import com.david.client.dto.UserDTO;
import com.david.client.rpc.ILoginService;
import com.david.client.rpc.ILoginServiceAsync;
import com.david.client.rpc.IUserManager;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

public class IUserManagerImpl extends RemoteService implements IUserManager {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public int addNewUser(UserDTO userDTO) {
		try {
			Session hbSession = getHibernateSession();
			hbSession.beginTransaction();
			hbSession.persist(userDTO);
			hbSession.getTransaction().commit();
		} catch (Exception e) {
			return DB_ERROR;
		}
		return SUCCESS;
	}

}
